#ifndef __Pipeline_h__
#define __Pipeline_h__

#include <vector>
#include "glm/glm.hpp"
#include "Graphics/Renderer.h"
#include "Graphics/Renderable.h"
#include "Utils/Array.h"

namespace RayFrame
{
  class Material;

  class PipelineProcedure
  {
  protected:
    Material* m_material;
  public:

    virtual STRING GetName() = 0;
    virtual STRING GetDesc() = 0;
    
    virtual void Render() = 0;
  };

  class Pipeline
  {
  protected:
    typedef std::vector<PipelineProcedure*> VecProc;
    typedef VecProc::iterator IterVProc;
    typedef std::map<STRING, PipelineProcedure*> MapProc;
    typedef MapProc::iterator IterMProc;

    VecProc m_vecProc;
    MapProc m_mapProc;
  public:
    Pipeline();
    virtual ~Pipeline();

    bool PushProcedure(PipelineProcedure* proc);

    void AddRenderable(STRING procName, Renderable* r);

    void Render(float timeElapsed);

    void PushMatrix(glm::mat4 m){ m_matrixStack.push_back(m); };
    glm::mat4 PopMatrix(){ m_matrixStack.pop_back(); };
    glm::mat4 GetMatrix(int pos){ return m_matrixStack[pos]; };
    int GetMatixCount(){ return m_matrixStack.size(); };
  protected:
    std::vector<glm::mat4> m_matrixStack;
  };
}

#endif // __Pipeline_h__